package com.example.concurrent.singleton2;

public final class Singleton {
	private Singleton() {}
	private static Singleton INSTANCE = null;
	//保证线程安全
	//锁的范围大，性能低
	public static synchronized Singleton getInstance() {
		if(INSTANCE != null) {
			return INSTANCE;
		}
		INSTANCE = new Singleton();
		return INSTANCE;
	}
}
